﻿using System;
using System.IO;
using System.Reflection;
using System.Resources;

using Game.Common;
using System.Windows.Media;
using System.Windows.Media.Imaging;

namespace Game.Toolkit.Internal
{
    static class VehicleResourceFile
    {
        public static BitmapImage Ark
        {
            get { return GetImage("mk1s_ark"); }
        }

        public static BitmapImage Assault
        {
            get { return GetImage("mk1v_assault"); }
        }

        public static BitmapImage Cobra
        {
            get { return GetImage("mk1v_cobra"); }
        }

        public static BitmapImage Cone
        {
            get { return GetImage("mk1s_cone"); }
        }

        public static BitmapImage Crab
        {
            get { return GetImage("mk1s_crab"); }
        }

        public static BitmapImage Fix
        {
            get { return GetImage("mk1s_fix"); }
        }

        public static BitmapImage Gunner
        {
            get { return GetImage("mk1i_gunner"); }
        }

        public static BitmapImage Nova
        {
            get { return GetImage("mk1v_nova"); }
        }

        public static BitmapImage Para
        {
            get { return GetImage("mk1i_para"); }
        }

        public static BitmapImage Shock
        {
            get { return GetImage("mk1i_shock"); }
        }

        public static BitmapImage Trooper
        {
            get { return GetImage("mk1i_astrooper"); }
        }

        public static BitmapImage Termite
        {
            get { return GetImage("mk1v_termite"); }
        }

        public static BitmapImage GetImage(string name)
        {
            BitmapImage image = new BitmapImage();
            string uri = 
                @"Game.Toolkit.Resources.Vehicle."
                + name + ".bmp";
            Assembly a = Assembly.GetExecutingAssembly();
            Stream stream = a.GetManifestResourceStream(uri);
            image.BeginInit();
            image.StreamSource = stream;
            image.CreateOptions = BitmapCreateOptions.None;
            image.EndInit();
            
            return image;
        }
    }
}
